#ifndef _D3D_D3DScreenShader_
#define _D3D_D3DScreenShader_

#include <windows.h>
#include <d3dx9.h>

#include "..\..\common\types.h"
#include "..\..\common\string.h"
#include "..\..\common\arraylist.hpp"
#include "..\..\common\hashtable.hpp"
#include "d3d_shader.h"
#include "..\interface_types.h"
#include "..\d3d.h"
#include "..\d3d_mesh.h"

class CD3D9Device; 

/**************************************
 *Implementation of the shader for the
 *D3D device
 **************************************/
struct D3DScreenShader :  public D3DShader
{	
	
protected:

	friend class CD3D9Device; 
	
	D3DScreenShader(CD3D9Device* const pDevice); 

	RenderTarget* m_pHBlur;
	RenderTarget* m_pVBlur;

	D3DXHANDLE m_pHBlurTechnique;
	D3DXHANDLE m_pVBlurTechnique;
	D3DXHANDLE m_pCompositionTechnique;

public:
	void AddRenderQue(const D3DMesh::RenderInstance& instance); 
	void AddRenderQue(D3DRenderable* pMesh, const Matrix4f& transform); 
	static string Identifier(); 

	void Execute(LPDIRECT3DSURFACE9 pFinalSurface, LPDIRECT3DTEXTURE9 pScreenBuffer);
	void Execute(const int flags = RENDER_DEFAULT); 
	void PostExecute(); 
	void PreExecute();
	HRESULT InitalizeParameters(LPD3DXEFFECT pEffect);
	string GetType() const; 
	void FlushRenderList(void);
	
	HRESULT Release();
	HRESULT Create(const string& filename);
}; 

#endif